package com.itxx.domain;

public class Student {
    private String name;
    private Integer chinese;
    private Integer math;
    private Integer english;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Student student = (Student) o;

        if (name != null ? !name.equals(student.name) : student.name != null) return false;
        if (chinese != null ? !chinese.equals(student.chinese) : student.chinese != null) return false;
        if (math != null ? !math.equals(student.math) : student.math != null) return false;
        return english != null ? english.equals(student.english) : student.english == null;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (chinese != null ? chinese.hashCode() : 0);
        result = 31 * result + (math != null ? math.hashCode() : 0);
        result = 31 * result + (english != null ? english.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", chinese=" + chinese +
                ", math=" + math +
                ", english=" + english +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getChinese() {
        return chinese;
    }

    public void setChinese(Integer chinese) {
        this.chinese = chinese;
    }

    public Integer getMath() {
        return math;
    }

    public void setMath(Integer math) {
        this.math = math;
    }

    public Integer getEnglish() {
        return english;
    }

    public void setEnglish(Integer english) {
        this.english = english;
    }

    public Student(String name, Integer chinese, Integer math, Integer english) {
        this.name = name;
        this.chinese = chinese;
        this.math = math;
        this.english = english;
    }

    public Student() {
    }

    public int getSum() {
        int sum = this.getChinese() + this.getEnglish() + this.getMath();
        return sum;
    }
}
